package com.itheima;

import com.itheima.pojo.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2020-08-05 09:22
 * @description 对象的作用域 单例/多例
 */
public class Test01 {


    public static void main(String[] args) {

        //今天学习spring框架 核心就是帮你创建对象的

        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");


        User user0101 = (User) context.getBean("user01");
        User user0102 = (User) context.getBean("user01");

        System.out.println("从spring容器中获取到希望要的user01对象:"+user0101);
        System.out.println("从spring容器中获取到希望要的user01对象:"+user0102);
    }

}
